package com.example.demo.controller;

import com.example.demo.common.response.ResponsePage;
import com.example.demo.common.response.ResponseResult;
import com.example.demo.entity.*;
import com.example.demo.entity.Dto.AbnormalInfo;
import com.example.demo.entity.Dto.HealthExaminationRecordDto;
import com.example.demo.entity.Dto.TotalInfo;
import com.example.demo.entity.Dto.VaccinationDto;
import com.example.demo.entity.VO.PetHealthInfo;
import com.example.demo.entity.VO.PetInfoDetail;
import com.example.demo.entity.VO.VaccinationRecord;
import com.example.demo.entity.VO.VaccinationVO;
import com.example.demo.entity.param.ExaminationRecordParam;
import com.example.demo.entity.param.PetParam;
import com.example.demo.entity.param.PetRecordInfoParam;
import com.example.demo.service.PetInfoService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/pet")
public class PetController {

    @Resource
    private PetInfoService petInfoService;

    @PostMapping("/getPetHeathInfo")
    public ResponseResult getPetHeathInfo(@RequestBody PetParam petParam) {
        ResponsePage<PetHealthInfo> petHealthInfoList = petInfoService.getPetHeathInfo(petParam);
        return ResponseResult.success(petHealthInfoList, "查询成功");
    }

    //添加宠物
    @PostMapping("/addPet")
    public ResponseResult addPet(@RequestBody Pet pet) {
        petInfoService.addPet(pet);
        return ResponseResult.success("添加成功");
    }

    //修改宠物信息
    @PostMapping("/editPet")
    public ResponseResult editPet(@RequestBody Pet pet) {
        petInfoService.editPet(pet);
        return ResponseResult.success("修改成功");
    }

    @PostMapping("getPet")
    public ResponseResult getPet(@RequestBody PetParam pet) {
        ResponsePage<Pet> petList = petInfoService.getPet(pet);
        return ResponseResult.success(petList, "查询成功");
    }

    /**
     *
        petInfo页宠物图片信息
     */
    @PostMapping("getPetInfo")
    public ResponseResult getPetInfo() {
        List<PetInfoDetail> petList = petInfoService.getPetInfo();
        return ResponseResult.success(petList, "查询成功");
    }

    @PostMapping("getPetInfo2")
    public ResponseResult getPetInfo2(@RequestBody PetInfoDetail pet) {
        List<PetInfoDetail> petList = petInfoService.getPetInfo2(pet);
        return ResponseResult.success(petList, "查询成功");
    }
    /**
     *
     petInfo页宠物档案信息
     */
    @PostMapping("editPetInfo")
    public ResponseResult editPetInfo(@RequestBody Pet pet) {
        petInfoService.editPetInfo(pet);
        return ResponseResult.success("修改成功");
    }
    /**
     *
     petInfo页宠物档案信息
     */
    @PostMapping("editPetImg")
    public ResponseResult editPetImg(@RequestBody PetImgs img) {
        petInfoService.editPetImg(img);
        return ResponseResult.success("修改成功");
    }

    /**
     *
     获取所有疫苗种类
     */
    @PostMapping("getAllVaccination")
    public ResponseResult getAllVaccination() {
        List<VaccinationVO> vaccinationList = petInfoService.getAllVaccination();
        return ResponseResult.success(vaccinationList, "查询成功");
    }
    /**
     *
     查看宠物接种记录信息
     */
    @PostMapping("getVaccinationRecord")
    public ResponseResult getVaccinationRecord() {
        List<VaccinationDto> vaccinationList = petInfoService.getVaccinationRecord();
        return ResponseResult.success(vaccinationList, "查询成功");
    }
    /**
     *
     添加疫苗记录
     */
    @PostMapping("addVaccinationRecord")
    public ResponseResult addVaccinationRecord(@RequestBody VaccinationRecord vaccinationRecord) {
        petInfoService.addVaccinationRecord(vaccinationRecord);
        return ResponseResult.success(null, "添加成功");
    }

    @PostMapping("updateVaccinationRecord")
    public ResponseResult updateVaccinationRecord(@RequestBody VaccinationRecord vaccinationRecord) {
        petInfoService.updateVaccinationRecord(vaccinationRecord);
        return ResponseResult.success(null, "修改成功");
    }
    /**
     *
     查询宠物健康体检记录
     */
    @PostMapping("getHealthCheckUpRecords")
    public ResponseResult getHealthCheckUpRecords(@RequestBody ExaminationRecordParam param) {
        List<PetHealthExaminationRecord> healthExaminationRecords =petInfoService.getHealthCheckUpRecords(param);
        return ResponseResult.success(healthExaminationRecords, "查找成功");
    }

    /**
     *
     查询宠物活动记录
     */
    @PostMapping("getPetActivityList")
    public ResponseResult getPetActivityList() {
        List<PetActivities> activityList =petInfoService.getPetActivityList();
        return ResponseResult.success(activityList, "查找成功");
    }
    /**
     *
     查询宠物喝水信息
     */
    @PostMapping("getPetDrinkInfo")
    public ResponseResult getPetDrinkInfo() {
        List<PetDrink> drinkList =petInfoService.getPetDrinkInfo();
        return ResponseResult.success(drinkList, "查找成功");
    }
    /**
     *
     添加宠物喝水信息
     */
    @PostMapping("addPetDrink")
    public  ResponseResult addPetDrink(@RequestBody PetDrink petDrink) {
        petInfoService.addPetDrink( petDrink);
        return ResponseResult.success(null, "添加成功");
    }
    /**
     *
     查看宠物异常记录
     */
    @PostMapping("getAnomalyRecord")
    public ResponseResult getAnomalyRecord(@RequestParam String anomaly) {
        List<AnomalyRecord> anomalyRecord =petInfoService.getAnomalyRecord(anomaly);
        return ResponseResult.success(anomalyRecord, "查找成功");
    }

    /**
     *
     查看宠物全部信息
     */
    @PostMapping("/getTotalInfoById")
    public ResponseResult getTotalInfoById(@RequestParam Integer id) {
        TotalInfo totalInfo =petInfoService.getTotalInfoById(id);
        return ResponseResult.success(totalInfo, "查找成功");
    }

    /**
     *
     查看宠物全部信息
     */
    @PostMapping("/addPetDailyInfo")
    public ResponseResult addPetDailyInfo(@RequestBody PetDailyData data) {
        petInfoService.addPetDailyInfo(data);
        return ResponseResult.success(null, "添加成功");
    }
    /**
     *
     查看宠物异常信息
     */
    @PostMapping("/checkPetAbnormalInfo")
    public ResponseResult checkPetAbnormalInfo() {
        AbnormalInfo abnormalInfo = petInfoService.checkPetAbnormalInfo();
        return ResponseResult.success(abnormalInfo, "添加成功");
    }

    /**
     *
     修改宠物异常记录
     */
    @PostMapping("/updatePetAbormal")
    public ResponseResult updatePetAbormal(@RequestBody AnomalyRecord record) {
         petInfoService.updatePetAbormal(record);
        return ResponseResult.success(null, "修改成功");
    }    /**
     *
     tianjia 宠物异常记录
     */
    @PostMapping("/addPetAbormal")
    public ResponseResult addPetAbormal(@RequestBody AnomalyRecord record) {
         petInfoService.addPetAbormal(record);
        return ResponseResult.success(null, "添加成功");
    }
    /**
     *
     查询医生列表
     */
    @PostMapping("/getDocList")
    public ResponseResult getDocList() {
      List<Doctor> docList =  petInfoService.getDocList();
        return ResponseResult.success(docList, "查询成功");
    }

    /**
     *
     新增医生
     */
    @PostMapping("/addDoctor")
    public ResponseResult addDoctor(@RequestBody Doctor doc) {
        petInfoService.addDoctor(doc);
        return ResponseResult.success(null, "新增成功");
    }

    /**
     *
     修改医生信息
     */
    @PostMapping("/editDocInfo")
    public ResponseResult editDocInfo(@RequestBody Doctor doc) {
        petInfoService.editDocInfo(doc);
        return ResponseResult.success(null, "修改成功");
    }
    /**
     *
     添加宠物信息报告
     */
    @PostMapping("/addPhysicalRecord")
    public ResponseResult addPhysicalRecord(@RequestBody PetRecordInfoParam param) {
        petInfoService.addPhysicalRecord(param);
        return ResponseResult.success(null, "添加成功");
    }
    /**
     *
     添加宠物信息报告
     */
    @PostMapping("/addPetHealthExaminationRecord")
    public ResponseResult addPetHealthExaminationRecord(@RequestBody PetHealthExaminationRecord record) {
        petInfoService.addPetHealthExaminationRecord(record);
        return ResponseResult.success(null, "添加成功");
    }

    /**
     *
     添加宠物信息报告
     */
    @PostMapping("/getPetHealthExaminationRecordList")
    public ResponseResult getPetHealthExaminationRecordList(@RequestParam Integer petId) {
       List<HealthExaminationRecordDto> recordList = petInfoService.getPetHealthExaminationRecordList(petId);
        return ResponseResult.success(recordList, "查询成功");
    }

    @PostMapping("/searchHealthExaminationRecordList")
    public ResponseResult searchHealthExaminationRecordList(@RequestBody HealthExaminationRecordDto param) {
       List<HealthExaminationRecordDto> recordList = petInfoService.searchHealthExaminationRecordList(param);
        return ResponseResult.success(recordList, "查询成功");
    }

    @PostMapping("petDataStatistic")
    public ResponseResult petDataStatistic() {
        Integer healthRecordNum =  petInfoService.petDataStatistic();
        return ResponseResult.success(healthRecordNum, "查询成功");
    }

    @PostMapping("addPetActivity")
    public ResponseResult addPetActivity(@RequestBody PetActivities petActivities) {
        petInfoService.addPetActivity(petActivities);
        return ResponseResult.success(null, "新增成功");
    }

    @PostMapping("cleanPetActivity")
    public ResponseResult cleanPetActivity(Integer petId) {
        petInfoService.cleanPetActivity(petId);
        return ResponseResult.success(null, "清空成功");
    }



}
